<template>
    <div class="tjlist-wrap" :style="tjlistbg">
        <img src="../../assets/images/tjlisttop.png" alt="" class="tjlistimg">
        <div class="tjTable">
            <ul>
                <li class="listHead">
                    <span>用户名</span>
                    <span>手机号码</span>
                    <span>状态</span>
                </li>
                <div class="listBody">
                    <li v-for="item in recommondList" :key="item.id">
                        <span>{{ item.nickName}}</span>
                        <span>{{ item.mobileNo}}</span>
                        <span>{{ status(item)}}</span>
                    </li>
                </div>
            </ul>
        </div>
        <button @click="backTJ">
            <img src="../../assets/images/tjback.png" alt="">
        </button>
    </div>
</template>

<script>
import { mapState,mapActions } from 'vuex'
export default {
    created(){
        this.checkRecommondList();
    },
    data(){
        return{
            tjlistbg:{
                backgroundImage: "url(" + require("../../assets/images/tjlistbg.png") + ")",
                backgroundRepeat: "repeat-y",
                backgroundSize: "100% 100%",
                backgroundPosition: '50% 50%'
            }
        }
    },
    methods:{
        ...mapActions({
            checkRecommondList:'personModules/checkRecommondList'
        }),
        backTJ(){
            this.$router.push({path: '/tuijian'})
        }
    },
    computed:{
        ...mapState({
            recommondList: state => state.personModules.recommondList
        }),
        status(){
            return (item) => {
                if(item.state === 1){
                    return '已推荐'
                }
                if(item.state === 2){
                    return '推荐成功'
                }
            }
        }
    }
}
</script>

<style lang="scss" scoped>
.tjlist-wrap{
    width: 100%;
    height: 100%;
    flex: auto;
    overflow: hidden;
    box-sizing: border-box;
    img.tjlistimg{
        width: 100%;
    }
    >button{
        border: none;
        background: none;
        width: 80%;
        margin: 20px auto 0;
        display: block;
        img{
            width: 100%;
        }
    }
}
.tjTable{
    background: #fff;
    border-radius:10px;
    width: 90%;
    margin: 0 auto;
    height: 50%;
    padding-bottom: 10px;
    ul{
        height: 100%;
        overflow: hidden;
        .listBody{
            max-height: 80%;
            overflow-y: auto;
        }
        li{
            display: flex;
            align-items: center;
            justify-content: space-around;
            padding: 10px;
            font-size: 14px;
            span{                
                color: #555;
                display: block;
                text-align: center;
                &:first-child{
                    width: 70px;
                }
                &:nth-child(2){
                    flex: auto
                }
                &:last-child{
                    width: 80px;
                    color: #EA7B49;
                }
            }
            &.listHead{
                border-bottom: 2px solid #ED3759;
                margin-bottom: 10px;
                span{
                    color: #EA7B49;
                    font-size: 16px;
                }
            }
        }
    }
}
</style>

